﻿from scipy import signal
import numpy
import pdb


#TODO: Comment in proper format, maybe use doc comments
#Follow the argument convention in signal.gaussian
def gaussianFilter(img,M,std):
    
    gh=signal.gaussian(M=25, std=3, sym=1)
    gw=signal.gaussian(M=25, std=3, sym=1)

    smoothImg=signal.sepfir2d(img, gw, gh);
    return(smoothImg)
    
#functions to add
#def calcGradientMag
# for our image coordinates we will assume 
#(x,y) and x+ is across the columns and y+ is down the rows
def gradientMag(img):

    #if the axis is 0 the filter will be applied down the columns
    #if the axis is 1 it will filter across the rows
    yGrad=signal.lfilter((1, -1), (1), img, axis=0, zi=None);  #in image coordinates this this filters
    xGrad=signal.lfilter((1, -1), (1), img, axis=1, zi=None);  #in image coordinates this this filters
        
    return(numpy.sqrt(numpy.square(xGrad) + numpy.square(yGrad)));
    
 #def minimizeE(rp,cp,n,gradMag,neighborhoodSize,d):
 #return;
    

